package com.shuoyue.ycgk.ui.recruitment.resume.major;

import android.os.Bundle;

import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.BaseMvpFragment;
import com.shuoyue.ycgk.base.baseadapter.IndexFragmentStateAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class FragmentMajorTab extends BaseMvpFragment {
    @BindView(R.id.tab_layout)
    TabLayout tabLayout;
    @BindView(R.id.viewpager)
    ViewPager viewpager;
    IndexFragmentStateAdapter indexFragmentStateAdapter;

    @Override
    public void initParams(Bundle bundle) {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_major_tab;
    }

    @Override
    protected void initView() {
        List<BaseMvpFragment> fragmentMainItems = new ArrayList<>();
        fragmentMainItems.add(FragmentMajorList.getInstance("专科"));
        fragmentMainItems.add(FragmentMajorList.getInstance("本科"));
        fragmentMainItems.add(FragmentMajorList.getInstance("研究生"));
        fragmentMainItems.add(FragmentMajorList.getInstance("博士"));

        viewpager.setOffscreenPageLimit(1);
        indexFragmentStateAdapter = new IndexFragmentStateAdapter(getChildFragmentManager(), fragmentMainItems);
        viewpager.setAdapter(indexFragmentStateAdapter);
        viewpager.setCurrentItem(0);
    }
}
